package com.trkj.controller.lzs;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.pojo.ProjectTemplate;
import com.trkj.pojo.SocialAccount;
import com.trkj.pojo.SocialLeixing;
import com.trkj.service.lzs.SocialAccountService;
import com.trkj.vo.Result2;

@Controller
public class SocialAccountController {
  @Autowired
    private   SocialAccountService  SocialAccountService;
	@RequestMapping("findAllSocialAccount")
	@ResponseBody
	public List<SocialAccount> SocialLeixingfall(){
		List<SocialAccount> list = SocialAccountService.SocialLeixingfall();
		return list;
	}
	
	//添加
			@RequestMapping("lzs_SocialAccountadd")
			@ResponseBody
			public void SocialLeixingtj(Timestamp socialCretordate,String socialName, Timestamp socialEndate,BigDecimal socialNumber, String socialPerson,String socialRemark,
					Timestamp socialStaratdate,Timestamp socialUpdatedate ){
				System.out.println("进来");
				SocialAccountService.SocialAccountadd(socialCretordate, socialName, socialEndate, socialNumber, socialPerson, socialRemark, socialStaratdate, socialUpdatedate);
			}
			
			/*修改
			*/
			@RequestMapping("lzs_SocialAccountxiugai")
			@ResponseBody  
			public  Result2 SocialAccountxiugai(long  socialId,Timestamp socialCretordate,String socialName, Timestamp socialEndate,BigDecimal socialNumber, String socialPerson,String socialRemark,
					Timestamp socialStaratdate,Timestamp socialUpdatedate) {
				try {
					SocialAccountService.lzs_SocialAccountbj(socialId, socialCretordate, socialName, socialEndate, socialNumber, socialPerson, socialRemark, socialStaratdate, socialUpdatedate);
					return Result2.SUCCESS;
				} catch (Exception e) {
						e.printStackTrace();
					return Result2.failure(e.getMessage());
				}
				
			}
			
			@RequestMapping("lzs_SocialAccountbj")
			@ResponseBody  
			 public SocialAccount chunq(Long socialId) {
		    	 return SocialAccountService.chun1(socialId);
		     }	

			//模糊查询shuoy
					@RequestMapping("lzs_SocialAccountchaxun")
					@ResponseBody
					public  List<SocialAccount> Query(String text){
						System.out.println(text);
						return (List<SocialAccount>) SocialAccountService.queryByName(text);
					}
					//删除；通过id查出相应的一条数据
					@RequestMapping("hr_ra_form_SocialAccount")
					@ResponseBody
					public boolean hr_ra_form_SalaryProj(Long socialId){
						 return SocialAccountService.dltRay(socialId);
					}
	}